package com.lysj.bhp.scheduled.service;

import com.google.gson.Gson;
import com.lysj.bhp.scheduled.base.ScheduledContent;

import com.lysj.bhp.util.http.HttpUtil;
import com.lysj.bhp.util.json.JacksonUtil;
import com.lysj.bhp.util.json.bcex.*;
import com.lysj.bhp.util.web.ParamUtil;
import com.lysj.bhp.util.web.Resp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 汇率相关服务类
 */
@Service
public class ExchangeRateService extends ScheduledContent {
    private static Logger logger = LoggerFactory.getLogger(ExchangeRateService.class);


    public Map<String, String> rates() {
        Map<String, String> map = new HashMap<>();
        String json = HttpUtil.sendGet(DOMAIN + "/admin/exchange_rate/rates", "");
        if (null == json) {
            return map;
        }
        Resp resp = new Gson().fromJson(json, Resp.class);
        if (resp == null || 200 != resp.getCode()) {
            return map;
        }
        map = (Map<String, String>) resp.getObj();
        return map;
    }
}
